using System.ComponentModel.DataAnnotations;

namespace Admin2025.Application.Configurations;

//文件上传配置
public class FileUploadSettings
{
    //最大文件大小（字节），默认10MB
    [Range(1, long.MaxValue, ErrorMessage = "最大文件大小必须大于0")]
    public long MaxFileSize { get; set; } = 10 * 1024 * 1024;//10MB

    //允许的文件扩展名
    public string[] AllowedExtensions { get; set; } = { ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp" };

    //允许的MIME类型
    public string[] AllowedMimeTypes { get; set; } =
    {
        "image/jpeg","image/jpg", "image/png","image/gif","image/bmp","image/webp"
    };

    //本地存储根路径
    [Required(ErrorMessage = "存储路径不能为空")]
    public string StorageRootPath { get; set; } = "wwwroot/uploads";

    //访问基础
    [Required(ErrorMessage = "访问基础URL不能为空")]
    public string BaseUrl { get; set; } = "https://localhost:7001";

    //是否启用缩略图生成
    public bool EnableThumbnail { get; set; } = true;

    //缩略图宽度
    [Range(50, 1000, ErrorMessage = "缩略图宽度必须在50-1000之间")]
    public int ThumbnailWith { get; set; } = 200;

    //缩略图高度
    [Range(50, 1000, ErrorMessage = "缩略图高度必须在50-1000之间")]
    public int ThumbnailHeight { get; set; } = 200;

    //是否按日期分文件夹存储
    public bool OrganizeByDate { get; set; } = true;

    //日期分文件夹格式
    public string DateFolderFormat { get; set; } = "yyy-MM-dd";
}